#pragma once

#include "Math/Maths.h"
#include "Engine/Engine Classes/SceneTree/SceneTree.h"
#include "Engine/PreApi Classes/Shader/IShader.h"

using maths::CVector4f;

typedef enum _LIGHTTYPE {
    LIGHT_POINT          = 1,
    LIGHT_SPOT           = 2,
    LIGHT_DIRECTIONAL    = 3,
    LIGHT_FORCE_DWORD    = 0x7fffffff, /* force 32-bit size enum */
} TLightType;

typedef struct  {
    TLightType   Type;             /* Type of light source */
    CVector4f   vDiffuse;          /* Diffuse color of light */
    CVector4f   vSpecular;         /* Specular color of light */
    CVector4f   vAmbient;          /* Ambient color of light */
    CVector4f   vPosition;         /* Position in world space */
    CVector4f   vDirection;        /* Direction in world space */
    float       fRange;            /* Cutoff range */
    float       fFalloff;          /* Falloff */
    float       fAtt0;             /* Constant attenuation */
    float       fAtt1;             /* Linear attenuation */
    float       fAtt2;             /* Quadratic attenuation */
    float       fTheta;            /* Inner angle of spotlight cone */
    float       fPhi;              /* Outer angle of spotlight cone */
} TLightProp;

class CLight: public CSceneNode
{
private:
    mUInt           m_uLightNum;
    TLightProp      m_LightProp;
    mBool           m_bEnabled;

    mVoid ReadFromFile      ( mString a_sFileName );

public:
    CLight                          ( mString a_sFileName );
    mVoid      Enable               ( mBool a_bValue );
    mVoid      SendToShader         ( CIShader *a_pIShader );
    maths::CVector4f&  Dir          ( );
    maths::CVector4f&  Pos          ( );
};